<?php

namespace app\admin\validate\chat;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class MemberAskServer
 * @package app\chat\validate
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 */
class MemberAskServer extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'isId',
        'userId' => 'integer|egt:0|max:11',
        'serverType' => 'integer|egt:0|max:3',
        'name' => 'scalar|max:60',
        'isChatFreely' => 'integer|max:1',
        'chatFreelyDuration' => 'integer|max:11',
        'questionsNum' => 'integer|egt:0|max:10',
        'isShowCallTel' => 'integer|max:1',
        'showCallTelDuration' => 'integer|max:11',
        'showPrice' => 'numeric',
        'price' => 'numeric',
        'icon' => 'scalar|max:200',
        'desc1' => 'scalar|max:200',
        'desc2' => 'scalar|max:200',
        'desc3' => 'scalar|max:200',
        'updated' => 'integer|egt:0|max:11',
        'created' => 'integer|egt:0|max:11',
        'page' => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id' => 'id',
        'userId' => 'userId',
        'serverType' => 'serverType',
        'name' => 'name',
        'isChatFreely' => 'isChatFreely',
        'chatFreelyDuration' => 'chatFreelyDuration',
        'questionsNum' => 'questionsNum',
        'isShowCallTel' => 'isShowCallTel',
        'showCallTelDuration' => 'showCallTelDuration',
        'showPrice' => 'showPrice',
        'price' => 'price',
        'icon' => 'icon',
        'desc1' => 'desc1',
        'desc2' => 'desc2',
        'desc3' => 'desc3',
        'updated' => 'updated',
        'created' => 'created',
        'page' => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => '缺少:attribute',
        'id.isId' => '请设置正确的:attribute',
        'userId.require' => '请输入:attribute',
        'userId.integer' => ':attribute应该是整数',
        'userId.egt' => ':attribute应该大于等于:rule',
        'userId.max' => ':attribute长度不能超过:rule位',
        'serverType.require' => '请输入:attribute',
        'serverType.integer' => ':attribute应该是整数',
        'serverType.egt' => ':attribute应该大于等于:rule',
        'serverType.max' => ':attribute长度不能超过:rule位',
        'name.require' => '请输入:attribute',
        'name.scalar' => ':attribute应该是字符串',
        'name.max' => ':attribute长度不能超过:rule位',
        'isChatFreely.require' => '请输入:attribute',
        'isChatFreely.integer' => ':attribute应该是整数',
        'isChatFreely.max' => ':attribute长度不能超过:rule位',
        'chatFreelyDuration.require' => '请输入:attribute',
        'chatFreelyDuration.integer' => ':attribute应该是整数',
        'chatFreelyDuration.max' => ':attribute长度不能超过:rule位',
        'questionsNum.require' => '请输入:attribute',
        'questionsNum.integer' => ':attribute应该是整数',
        'questionsNum.egt' => ':attribute应该大于等于:rule',
        'questionsNum.max' => ':attribute长度不能超过:rule位',
        'isShowCallTel.require' => '请输入:attribute',
        'isShowCallTel.integer' => ':attribute应该是整数',
        'isShowCallTel.max' => ':attribute长度不能超过:rule位',
        'showCallTelDuration.require' => '请输入:attribute',
        'showCallTelDuration.integer' => ':attribute应该是整数',
        'showCallTelDuration.max' => ':attribute长度不能超过:rule位',
        'showPrice.require' => '请输入:attribute',
        'showPrice.numeric' => ':attribute应该是数字',
        'price.require' => '请输入:attribute',
        'price.numeric' => ':attribute应该是数字',
        'icon.require' => '请输入:attribute',
        'icon.scalar' => ':attribute应该是字符串',
        'icon.max' => ':attribute长度不能超过:rule位',
        'desc1.require' => '请输入:attribute',
        'desc1.scalar' => ':attribute应该是字符串',
        'desc1.max' => ':attribute长度不能超过:rule位',
        'desc2.require' => '请输入:attribute',
        'desc2.scalar' => ':attribute应该是字符串',
        'desc2.max' => ':attribute长度不能超过:rule位',
        'desc3.require' => '请输入:attribute',
        'desc3.scalar' => ':attribute应该是字符串',
        'desc3.max' => ':attribute长度不能超过:rule位',
        'updated.require' => '请输入:attribute',
        'updated.integer' => ':attribute应该是整数',
        'updated.egt' => ':attribute应该大于等于:rule',
        'updated.max' => ':attribute长度不能超过:rule位',
        'created.require' => '请输入:attribute',
        'created.integer' => ':attribute应该是整数',
        'created.egt' => ':attribute应该大于等于:rule',
        'created.max' => ':attribute长度不能超过:rule位',
        'page.require' => '请输入:attribute',
        'page.integer' => ':attribute应该是整数',
        'page.egt' => ':attribute应该大于等于:rule',
        'page.max' => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt' => ':attribute应该大于等于:rule',
        'page_size.max' => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index' => ['page', 'page_size'],
        'read' => ['id' => 'require'],
        'save' => ['name' , 'isChatFreely', 'chatFreelyDuration', 'questionsNum', 'isShowCallTel', 'showCallTelDuration', 'showPrice', 'price', 'icon', 'desc1', 'desc2', 'desc3', 'updated', 'created'],
    ];

}
